package _Pan3D.program.shaders
{
	import _Pan3D.program.Shader3D;
	
	public class ScanningShader extends Shader3D
	{
		public static var SCANNINGSHADER:String = "ScanningShader";
		public function ScanningShader()
		{
			vertex = 
				"m44 vt0, va0, vc4 \n" +
				"m44 vt1, vt0, vc0 \n" +
				//"m44 op, vt0, vc0 \n" +
				
				"div vt2.x,vt0.z,vc8.x \n" +
				"mul vt1.x,vt0.x,vt2.x\n"+
				"mul vt1.y,vt0.y,vt2.x\n"+
				"neg vt1.y,vt1.y \n"+
				"neg vt1.x,vt1.x \n"+
				
				
				"mov op, vt1 \n" +
				
				"mov v5, vt0\n"+
				//"mov v2, va2\n"+//为了使用va2
				"mov v1, va1";
			fragment = 
				"tex ft0, v1, fs1 <2d,linear>\n"+
				//"mov ft1, v2 \n" +//为了使用va2
				//"tex ft1, v1, fs2 <2d,linear>\n"+//为了使用fs2
				
				"abs ft4.z,v5.z\n"+           //存入深度
				"mov ft0.z,fc5.w\n"+
				"div ft4.z,ft4.z,fc5.x \n"+
				"frc ft0.x,ft4.z\n"+         //得到第一位存在X
				"sub ft4.z,ft4.z,ft0.x\n"+
				"div ft4.z,ft4.z,fc5.x\n"+
				"frc ft0.y,ft4.z\n"+         //得到第二位存在y
				
				"mov oc, ft0";
		}
	}
}